﻿#region Copyright(C) 2018 FI Ltd. All rights reserved.
// ==================================================================================================
// Copyright(C) 2018 FI Ltd. All rights reserved.
//
// SYSTEM NAME	    : FI.Net Application Framework
// COMPONENT ID	    : FI.Core
// COMPONENT DESC   : FI.Net Core Foundation
//
// CREATED DATE/BY  : 18 Aug 2018 / Tian Mi
//
// REVISION HISTORY :	
// DATE/BY			SR#/CS/PM#/OTHERS		DESCRIPTION OF CHANGE
// ==================================================================================================
#endregion

using System.Runtime.Serialization;
using FI.Core.Utilities;

namespace FI.Core
{
    /// <summary>
    /// A <see cref="LocalizableText"/> object represents a culture specific text.
    /// </summary>
    [DataContract(Namespace = Constants.Namespace)]
    public class LocalizableText
    {
        /// <summary>
        /// Gets the culture.
        /// </summary>
        /// <value>
        /// The culture.
        /// </value>
        [DataMember]
        public string Culture { get; private set; }


        /// <summary>
        /// Gets the text.
        /// </summary>
        /// <value>
        /// The text.
        /// </value>
        [DataMember]
        public string Text { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="LocalizableText"/> class.
        /// </summary>
        /// <param name="culture">The culture.</param>
        /// <param name="text">The text.</param>
        public LocalizableText(string culture, string text)
        {
            Guard.ArgumentNotNullOrEmpty(text, "text");
            this.Culture = culture;
            this.Text = text;
        }

        /// <summary>
        /// Gets a value indicating whether this instance is culture neutral.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance is culture neutral; otherwise, <c>false</c>.
        /// </value>
        public virtual bool IsCultureNeutral
        {
            get { return string.IsNullOrEmpty(this.Culture); }
        }
    }
}
